# -*- coding:utf-8 -*-
# @Time : 2021/10/21 15:09
# @Author : zvs
# @File : scatter_squares
# @Project : untitled
import matplotlib.pyplot as plt

# input_values = [1,2,3,4,5]
# squares = [1,4,9,16,25]
input_values = range(1, 1001)
squares = [x**2 for x in input_values]

plt.style.use('seaborn')

plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签
plt.rcParams['axes.unicode_minus']=False #用来正常显示负号

fig, ax = plt.subplots()
# ax.scatter(input_values, squares, c=(0, 0.5, 0.5), s=10)#确定绘制的点的样式
ax.scatter(input_values, squares, c=squares, cmap=plt.cm.Blues, s=10)

#设置图表标题并给坐标轴加上标签
ax.set_title('平方数', fontsize=24)
ax.set_xlabel('值', fontsize=14)
ax.set_ylabel('值的平方', fontsize=14)

#设置刻度标记的大小
# ax.tick_params(axis='both', labelsize=14)
ax.tick_params(axis='both', which='major', labelsize=14)

#设置刻度的范围
ax.axis([0, 1100, 0, 1100000])

# plt.show()
plt.savefig('squares_plot.png', bbox_inches='tight')